home *** CD-ROM | disk | FTP | other *** search
- <html>
-
- <head>
-
- <title>Walk The Dog</title>
-
- </head>
-
- <body bgcolor="white">
-
- <script language="JavaScript1.2">
-
- <!--//
-
-
-
- //first off, the page sets itself to capture the
-
- //MOUSEDOWN event and route it to the moveLayer handler
-
-
-
- window.captureEvents(Event.MOUSEDOWN);
-
- window.onmousedown = moveLayer;
-
-
-
-
-
- //The moveLayer function takes the mousedown event, and throws
-
- //where the user clicked to the slideTo function. It also moves
-
- //the cartoon style 'blurb' layer to where the mouse was clicked,
-
- //changing it to visible, and releases the MOUSEDOWN event.
-
-
-
- function moveLayer(e) {
-
- slideTo(document.layers['slider'], e.pageY, e.pageX);
-
- document.layers['blurb'].moveTo(e.pageX, e.pageY);
-
- document.layers['blurb'].visibility = true;
-
- window.releaseEvents(Event.MOUSEDOWN);
-
- }
-
-
-
- //the only thing added to this iteration of the sliderTo function
-
- //was and 'else' block, that hides the 'blurb' layer, then re-enables
-
- //capturing of the MOUSEDOWN event. The reason I release the event
-
- //is to avoid confusing the script by recursively calling the slideTo
-
- //function with different coordinates.
-
-
-
- function slideTo(targetLayer, targetTop, targetLeft) {
-
- if((targetLayer.top != targetTop) || (targetLayer.left != targetLeft)) {
-
- if (targetLayer.top < targetTop) targetLayer.top = targetLayer.top + 1;
-
- if (targetLayer.top > targetTop) targetLayer.top = targetLayer.top - 1;
-
- if (targetLayer.left < targetLeft) targetLayer.left = targetLayer.left + 1;
-
- if (targetLayer.left > targetLeft) targetLayer.left = targetLayer.left - 1;
-
- setTimeout('slideTo(document.layers["'+targetLayer.name+'"],'+targetTop+','+targetLeft+')',1);
-
- } else {
-
- window.captureEvents(Event.MOUSEDOWN);
-
- document.layers['blurb'].visibility = false;
-
- }
-
- }
-
- //-->
-
- </script>
-
- <body bgcolor="white">
-
-
-
- <!-- the 'slider' layer hold the picture of the puppy -->
-
- <layer z-index=2 id="slider" height=50 width=50 top=0 left=0>
-
- <img src="puppy.gif" border=0 height=50 width=50>
-
- </layer>
-
- <!-- the 'blurb' layer is invisible until the user clicks on the page -->
-
- <!-- when it is moved to the spot clicked, and shown -->
-
-
-
- <layer z-index=1 visibility=hide id="blurb" width=50 height=50 top=100 left=100>
-
- <img width=50 height=50 src="cartoon.gif">
-
- </layer>
-
- </body>
-
- </html>
-
-